﻿using UnityEngine;
using UnityEditor;
using UnityEditor.Extension;
using UnityEditor.UI;
using System;
using System.Extension;
using System.Reflection.Extension;

[CustomEditor(typeof(SubjectiveSlider))]
public class SubjectiveSliderInspector : SliderEditor  
{
    SerializedProperty valuesubject, maxvaluesubject;
    SerializedProperty animate, animationSpeed;

    protected override void OnEnable()
    {
        base.OnEnable();
        valuesubject = serializedObject.FindProperty("m_valueSubject");
        maxvaluesubject = serializedObject.FindProperty("m_maxValueSubject");
        animate = serializedObject.FindProperty("m_animate");
        animationSpeed = serializedObject.FindProperty("m_animationSpeed");
    }

    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        serializedObject.Update();
        EditorGUILayout.PropertyField(animate);
        EditorGUILayout.PropertyField(animationSpeed);
        EditorGUILayout.PropertyField(valuesubject);
        EditorGUILayout.PropertyField(maxvaluesubject);
        serializedObject.ApplyModifiedProperties();
    }

    [MenuItem("GameObject/UI/Subjective/Slider")]
    static void CreateSubjectiveSlider()
    {
        GameObjectMenu.CreateNewControlInHierarchy("Slider", typeof(CanvasRenderer), typeof(SubjectiveSlider));
    }
}
